<!DOCTYPE html>
<html class="x-admin-sm">

    <head>
        <meta charset="UTF-8">
        <title>欢迎页面-X-admin2.2</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="/admin/static/css/font.css">
        <link rel="stylesheet" href="/admin/static/css/xadmin.css">
        <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
        <script src="/admin/static/lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="/admin/static/js/xadmin.js"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
    </head>

    <body>
        <div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="">首页</a>
                <a href="">演示</a>
                <a>
                    <cite>导航元素</cite></a>
            </span>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
                <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
            </a>
        </div>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">


                        <div class="layui-card-body ">
                            <table class="layui-table layui-form">
                              <thead>
                                <tr>
                                  <th width="20">
                                    <input type="checkbox" name="" lay-skin="primary">
                                  </th>
                                  <th>ID</th>
                                  <th >回帖ID</th>
                                    <th>回复帖子</th>
                                  <th >回复内容</th>
                                  <th >回复时间</th>
                                  <th >上一级评论ID</th>
                                  <th>状态</th>
                                  <th >操作</th>
                              </thead>
                              <tbody class="x-cate">
                              @foreach($data as $val)
                                <tr  >
                                  <td>
                                    <input type="checkbox" name="" id="{{$val->id}}" lay-skin="primary">
                                  </td>
                                  <td>{{$val->id}}</td>
                                  <td class="">
                                      {{$val->name}}
                                  </td>
                                    <td>{{$val->title}}</td>
                                    <td>{{$val->content}}</td>
                                    <td>{{$val->created_at}}</td>
                                    <td>{{$val->pid}}</td>
                                  <td>
                                      <span class="layui-btn layui-btn-normal layui-btn-mini">已启用</span></td>
                                  </td>
                                  <td class="td-manage">

                                          <button class="layui-btn-danger layui-btn layui-btn-xs"  onclick="member_del(this,{{$val->id}})" href="javascript:;" ><i class="layui-icon">&#xe640;</i>删除</button>
                                  </td>
                                </tr>
                                @endforeach
                              </tbody>
                            </table>
                        </div>
                        <div class="layui-card-body ">
                            <div class="page">
                                <div>
                                    {{ $data->links() }}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <script>
          layui.use(['form'], function(){
            form = layui.form;

          });

           /*用户-删除*/
          function member_del(obj,id){
              layer.confirm('确认要删除吗？',function(index){
                  //发异步删除数据

                  $.ajax({
                      type: 'post',
                      url: '/admin/message/del/'+id,
                      data: {
                          '_token':'{{csrf_token()}}',
                      },
                      dataType: 'json',
                      success: function(data) {
                          $(obj).parents("tr").remove();
                          layer.msg('已删除!',{icon:1,time:1000});
                      },
                      error: function(data) {
                          console.log(data.msg);
                      },
                  });

              });
          }


        </script>
    </body>
</html>
